<!-- begin: main content area #main -->
<div id="main">
	<!-- begin: #col1 - first float column -->
	<div id="col1">
		<div id="col1_content" class="clearfix"> <a id="content" name="content"></a>
			<!-- skiplink anchor: Content -->
			<style lang="text/css">
			.orderPad {

			}
			.fieldHeading {
				font-weight:bold;
				vertical-align:top;
				text-align:left;
			}
			.fieldValue {
				vertical-align:top;
				line-height: 1.6em;
				background-color:#EFEFEF;
			}
			input {
				border: 1px solid #666;
				background:white;
				height:20px; 
				width:100%;
				font-size:110%;
			}
			.fieldWithErrors input {
				border: 1px solid red;
			}
			.standardCheckBox {
				width: 15px; 
				height: 15px;
			}
			.bigButton {
				width: 200px;
				height: 20px;
				border: 1px solid black;
			}
			.errorExplanation h2 { display:none ;}
			.errorExplanation p,li { color:red; }
			
			</style>
			
			<form action="/customers" method="POST">
			<input type="hidden" name="_method" value="POST">
			<table class="full continuous">
					<thead>
					<tr>
						<th>CUSTOMER DETAILS #<%= @customer.id %> - <%= @customer.name %></th>
					</tr>
					</thead>
			</table>
			<table class="full continuous">
					<tr>
						<th class="sub" colspan="4">General Details</th>
					</tr>
					<tr>
						<td class="fieldValue" width="25%">
							<strong>Company Name</strong><br />
							<%= text_field "customer", "name" %>
						</td>
						<td class="fieldValue"  width="25%">
							<strong>Alternate Name</strong><br />
							<%= text_field "customer", "alternate_name" %>
						</td>
						<td class="fieldValue" width="25%">
							<strong>Country</strong><br />
							<select name="customer[country_id]" style="width:180px"><%= options_from_collection_for_select(Country.find(:all), "id", "name", @customer.country_id) %></select>
						</td>
						</td>

						<td class="fieldValue">
							<strong>Status</strong><br />
							<select name="customer[status_id]" style="width:100%"><%= options_from_collection_for_select(CustomerStatus.find(:all), "id", "name", @customer.status_id) %></select>
						</td>
					</tr>
					<tr>
						<td class="fieldValue">
							<strong>Phone</strong><br />
							<%= text_field "customer", "phone" %>
						</td>
						<td class="fieldValue">
							<strong>Fax</strong><br />
							<%= text_field "customer", "fax" %>
						</td>
						<td class="fieldValue">
							<strong>Email</strong><br />
							<%= text_field "customer", "email" %>
						</td>
						<td class="fieldValue">
							<strong>Website</strong><br />
							<%= text_field "customer", "website_url" %>
						</td>
					</tr>
				</table>
				<table class="full continuous">
						<tr>
							<th class="sub" colspan="3">Pricing Details</th>
						</tr>
					<tr>
						<td class="fieldValue" width="33%">
							<strong>Price Type</strong><br />
							<select name="customer[price_type_id]"  style="width:100%"><%= options_from_collection_for_select(PriceType.find(:all), "id", "code", @customer.price_type_id) %></select>
								
						</td>
						<td class="fieldValue">
							<strong>Payment Terms</strong><br />
							<select name="customer[payment_term_id]"  style="width:100%"><%= options_from_collection_for_select(PaymentTerm.find(:all), "id", "terms_text", @customer.payment_term_id) %></select>
						</td>
						<td class="fieldValue" width="33%">
							<strong>Agent(s)</strong><br />
							   <% Agent.find(:all).each do |a| %>
   								<%= check_box_tag 'customer[agent_ids][]', a.id, @customer.agents.include?(a), :class => 'standardCheckBox' %><%= a.name %><br />
    							<% end %>
   							
   
						</td>
					</tr>

			</table>
			<table class="full continuous">
					<tr>
						<th class="sub">Addresses</th>
					</tr>
					<tr>
						<td class="fieldValue">
							<% @customer.addressables.each do |a| %>
							  <div class="addressBlock" style="width:30%;border:1px solid #ccc;float:left;margin-right:2px;padding:5px">
								<strong>Address: </strong><br />
								<%= a.address.address %><br />
								<strong>City:</strong><br />
								<%= a.address.city %><br />
								<strong>Province / Postcode:</strong><br />
								<%= a.address.postcode %><br />
								<strong>Country:</strong><br />
								<%= a.address.country.name %><br />
								<% if a.is_default? %>
									<strong style="color:green">Default <%= a.type %> address</strong>
								<% end %>
							  </div>

							<% end %>
						</td>
					</tr>
					<tr>
						<th class="sub" colspan="4">
							<%= error_messages_for 'customer' %>
							
						</th>
					</tr>
					<tr>
						<td valign="right"><input type="submit" value="Save Changes" class="bigButton"></td>
					</tr>
			</table>
			</form>
		</div>
	</div>
	<!-- end: #col1 -->
	<!-- begin: #col3 static column -->
	<div id="col3">
		<div id="col3_content" class="clearfix">
			<ul id="submenu">
				<li id="title">Actions</li>
				<li><a href="#"> &nbsp;Edit Customer</a></li>
				<li><a href="#"> &nbsp;View Sales Report</a></li>
				
			</ul>
		</div>
		<div id="ie_clearing">&nbsp;</div>
		<!-- End: IE Column Clearing -->
	</div>
	<!-- end: #col3 -->
</div>
<!-- end: #main -->
